<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //编写一个函数calculateAverage，接受一个数字数组作为参数，并返回数组的平均值.
        const numbers = [1, 2, 3, 4, 5];
        function calculateAverage(arr) {
    let sum = 0;
  for (let i = 0; i < arr.length; i++) {
    sum += arr[i];
  }
  return sum / arr.length;
}

console.log(calculateAverage(numbers));
    </script>
</body>
</html>